home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / message / subcls / dropfile.bas < prev    next >
Encoding:
BASIC Source File  |  1995-06-26  |  1.0 KB  |  29 lines

  1. Option Explicit
  2.  
  3. Declare Function GetWindowLong Lib "User" (ByVal hWnd As Integer, ByVal nIndex As Integer) As Long
  4. Declare Function SetWindowLong Lib "User" (ByVal hWnd As Integer, ByVal nIndex As Integer, ByVal dwNewLong As Long) As Long
  5. Declare Sub DragAcceptFiles Lib "shell.dll" (ByVal hWnd%, ByVal fAccept%)
  6. Declare Sub DragFinish Lib "shell.dll" (ByVal hDrop%)
  7. Declare Function DragQueryFile Lib "shell.dll" (ByVal hDrop%, ByVal iFile%, ByVal lpszFile$, ByVal cb%) As Integer
  8.  
  9. ' Constants used to alter window style
  10. Global Const GWL_EXSTYLE = (-20)
  11. Global Const WS_EX_ACCEPTFILES = &H10&
  12.  
  13. ' Constant which notifies of drag-and-drop
  14. Global Const WM_DROPFILES = &H233
  15.  
  16. Sub AcceptDrops (hWnd As Integer)
  17.    Dim Style As Long
  18.    '
  19.    ' Set to accept dropped files from File Manager
  20.    '
  21.    Style = GetWindowLong(hWnd, GWL_EXSTYLE)
  22.    Style = SetWindowLong(hWnd, GWL_EXSTYLE, Style Or WS_EX_ACCEPTFILES)
  23.    '
  24.    ' Notify system we want to accept dropped files
  25.    '
  26.    DragAcceptFiles hWnd, True
  27. End Sub
  28.  
  29.